# 作者: 陈其志 
# 2025年02月20日20时29分11秒 
# 2716847110@qq.com
class Animal:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def eat(self):
        print('eat')

    def drink(self):
        print('drink')

    def run(self):
        print('run')

    def sleep(self):
        print('sleep')


class Dog(Animal):
    def __init__(self, name, age, color):
        # self.name = name
        super().__init__(name, age)  # 调用父类的name
        self.age = color


class Cat(Animal):
    def __init__(self, name, age, color):
        # self.name = name
        super().__init__(name, age)  # 调用父类的name
        self.age = color


class XiaoTianQuan(Dog):
    def fly(self):
        print('fly')

    def __init__(self, name, age, color, weapon):
        super().__init__(name, age, color)
        self.weapon = weapon


if __name__ == '__main__':
    da_huang = Dog('大黄', 2, '黄色')
    print(da_huang.name)  # 这里使用的父类Animal的name属性
    xiao_hong = Cat('小红', 1, '红色')
